package com.bw.dg.controller;


import com.bw.dg.pojo.Dept;
import com.bw.dg.service.DeptService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@CrossOrigin
public class DeptController {
    @Autowired
    private DeptService deptService;
    @RequestMapping("deptlist")
    public List deptlist(){
        return this.deptService.deptlist();

    }
    @RequestMapping("adds")
    public Dept adds(@RequestBody Dept dept){
        return this.deptService.adds(dept);

    }
    @RequestMapping("del")
    public String del(@RequestParam("id") String id){
       String[] ids=id.split(",");
       for (String aa:ids){
           this.deptService.del(aa);
       }
        return "删除成功";
    }


}
